package gist

import scala.xml.XML

object FromRepox extends App {
  case class Key(k: String)

  case class Value(v: String)

  val keys = IndexedSeq(Key("1"), Key("2"), Key("3"), Key("4"), Key("5"))
  val values = Vector(Value("One"), Value("Two"), Value("Three"), Value("Four"), Value("Five"))

  implicit class string2Map(k: String) {
    def use(v: String) =
      keys.find(_.k == k).get -> values.find(_.v == v).get
  }

  val map = Map("1" use "One", "2" use "Two", "3" use "Three", "4" use "Four", "5" use "Five")

  println(map)

  println(s"${"${map}"}")

  case class Foo[A](command: String, data: A)

  object -> {
    def unapply[A, B](p: (A, B)) = Some(p)
  }

  Foo("foo", (42, 'whatever)) match {
    case "foo" Foo (data) -> _ => println(data)
  }

  Foo("foo", (42, 'whatever)) match {
    case Foo("foo", data -> _) => println(data)
  }
  
  println("->.unapply(42, 'whatever):"+ ->.unapply(42, 'whatever))
  
  val xml = XML.load("D:/baiduapp/tmp/qing_1.xml")
  val node = xml \\ "url"
  println("node:" + node.size)
}